package rad.framework.mda.generator.template.main.java.seam;

import java.util.*;
import org.eclipse.uml2.uml.*;
import rad.framework.mda.generator.util.*;
import org.eclipse.emf.codegen.util.*;

public class EditorBean
{
  protected static String nl;
  public static synchronized EditorBean create(String lineSeparator)
  {
    nl = lineSeparator;
    EditorBean result = new EditorBean();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "";
  protected final String TEXT_2 = "/*" + NL + " * ============================================================================" + NL + " *                   GNU Lesser General Public License" + NL + " * ============================================================================" + NL + " */" + NL + "package ";
  protected final String TEXT_3 = ".editor;" + NL;
  protected final String TEXT_4 = NL + NL + "/**" + NL + " * The implementation of the Editor interface." + NL + " *" + NL + " * @author ";
  protected final String TEXT_5 = NL + " * @generated" + NL + " */";
  protected final String TEXT_6 = NL + "@Name(\"";
  protected final String TEXT_7 = "Editor\")" + NL + "@Stateful";
  protected final String TEXT_8 = NL + "public class ";
  protected final String TEXT_9 = "EditorBean extends AbstractEditorBean< ";
  protected final String TEXT_10 = " > implements ";
  protected final String TEXT_11 = "Editor {";
  protected final String TEXT_12 = NL + "public abstract class ";
  protected final String TEXT_13 = "EditorBean<E extends ";
  protected final String TEXT_14 = "> extends AbstractEditorBean< E > {";
  protected final String TEXT_15 = NL + "public abstract class ";
  protected final String TEXT_16 = "EditorBean<E extends ";
  protected final String TEXT_17 = "> ";
  protected final String TEXT_18 = "< E > {";
  protected final String TEXT_19 = NL + "public ";
  protected final String TEXT_20 = "class ";
  protected final String TEXT_21 = "EditorBean ";
  protected final String TEXT_22 = "< ";
  protected final String TEXT_23 = " > implements ";
  protected final String TEXT_24 = "Editor {";
  protected final String TEXT_25 = NL + "\t/** @generated */" + NL + "\tprivate static final long serialVersionUID = 1L;";
  protected final String TEXT_26 = NL + NL + "\t/** @generated */" + NL + "\tpublic RootTreeNode init";
  protected final String TEXT_27 = "Tree() {" + NL + "\t\treturn initRoot(new ";
  protected final String TEXT_28 = "TreeNode(null, getInstance()));" + NL + "\t}" + NL + "" + NL + "\t/** @generated */" + NL + "\t@Factory(value=\"";
  protected final String TEXT_29 = "\", scope=ScopeType.EVENT, autoCreate=true)" + NL + "\tpublic ";
  protected final String TEXT_30 = " init";
  protected final String TEXT_31 = "() {" + NL + "\t\treturn getInstance(); " + NL + "\t}" + NL + "    " + NL + "\t/** @generated */" + NL + "\t@Override" + NL + "\tprotected ";
  protected final String TEXT_32 = " createInstance() {" + NL + "\t\t";
  protected final String TEXT_33 = " result = new ";
  protected final String TEXT_34 = "();" + NL + "//\t\tresult.setUser(getCurrentUserName());" + NL + "\t\treturn result;" + NL + "\t}";
  protected final String TEXT_35 = NL + NL + "\t/** @generated */" + NL + "\tpublic boolean isSimpleEntity() {" + NL + "\t\treturn true;" + NL + "\t}";
  protected final String TEXT_36 = NL + NL + "\t/** @generated */" + NL + "\tprotected void prePersist() {" + NL + "\t\tsuper.prePersist();";
  protected final String TEXT_37 = NL + "\t\tif (getInstance().get";
  protected final String TEXT_38 = "() != null) {" + NL + "\t\t\tgetInstance().get";
  protected final String TEXT_39 = "().add";
  protected final String TEXT_40 = "(getInstance());" + NL + "\t\t} ";
  protected final String TEXT_41 = NL + "\t\tif (getInstance().get";
  protected final String TEXT_42 = "() != null) {" + NL + "\t\t\tgetInstance().get";
  protected final String TEXT_43 = "().set";
  protected final String TEXT_44 = "(getInstance());" + NL + "\t\t} ";
  protected final String TEXT_45 = NL + "\t}" + NL + "" + NL + "\t/** @generated */" + NL + "\tprotected void preRemove() {" + NL + "\t\tsuper.preRemove();";
  protected final String TEXT_46 = NL + "\t\tif (getInstance().get";
  protected final String TEXT_47 = "() != null) {" + NL + "\t\t\tgetInstance().get";
  protected final String TEXT_48 = "().remove";
  protected final String TEXT_49 = "(getInstance());" + NL + "\t\t} ";
  protected final String TEXT_50 = " ";
  protected final String TEXT_51 = NL + "\t\tif (getInstance().get";
  protected final String TEXT_52 = "() != null) {" + NL + "\t\t\tgetInstance().get";
  protected final String TEXT_53 = "().set";
  protected final String TEXT_54 = "(null);" + NL + "\t\t} ";
  protected final String TEXT_55 = " " + NL + "\t}";
  protected final String TEXT_56 = NL + NL + "\t/** @generated */" + NL + "\tprotected boolean canDelete() {" + NL + "\t\tif (!super.canDelete()) {" + NL + "\t\t\treturn false;" + NL + "\t\t}" + NL + "\t\t" + NL + "\t\tlong count = 0;";
  protected final String TEXT_57 = NL + "\t\tcount += countReferences(\"from ";
  protected final String TEXT_58 = " where ";
  protected final String TEXT_59 = " = :me\");";
  protected final String TEXT_60 = NL + "\t\tif (getInstance().get";
  protected final String TEXT_61 = "() != null) {" + NL + "\t\t\tcount++;" + NL + "\t\t}" + NL;
  protected final String TEXT_62 = NL + "\t\treturn count == 0;" + NL + "\t}";
  protected final String TEXT_63 = " ";
  protected final String TEXT_64 = NL + NL + "\t/**" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * --- ";
  protected final String TEXT_65 = " ManyToOne Association" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t@Out" + NL + "\tprotected ComboBox ";
  protected final String TEXT_66 = "ComboBox = new ";
  protected final String TEXT_67 = "ComboBox<";
  protected final String TEXT_68 = "Editor, ";
  protected final String TEXT_69 = ">(this, \"";
  protected final String TEXT_70 = "\");\t";
  protected final String TEXT_71 = NL + NL + "\t/**" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * --- ";
  protected final String TEXT_72 = " Composed ManyToOne Association" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t@Out" + NL + "\tprotected ComboBox ";
  protected final String TEXT_73 = "ComboBox = new ";
  protected final String TEXT_74 = "ComboBox<";
  protected final String TEXT_75 = "Editor, ";
  protected final String TEXT_76 = ">(this, \"";
  protected final String TEXT_77 = "\");\t";
  protected final String TEXT_78 = NL + NL + "\t/**" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * --- ";
  protected final String TEXT_79 = " ManyToOne Association" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t@Out" + NL + "\tprotected ComboBox ";
  protected final String TEXT_80 = "ComboBox = new ";
  protected final String TEXT_81 = "ComboBox<";
  protected final String TEXT_82 = "Editor, ";
  protected final String TEXT_83 = ">(this, \"";
  protected final String TEXT_84 = "\") {";
  protected final String TEXT_85 = NL + "\t\tpublic boolean isRendered() {" + NL + "\t\t\treturn getComponent().isTop();" + NL + "\t\t}";
  protected final String TEXT_86 = NL + "\t};\t";
  protected final String TEXT_87 = " ";
  protected final String TEXT_88 = NL + NL + "\t/**" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * --- ";
  protected final String TEXT_89 = " OneToMany ";
  protected final String TEXT_90 = "Association" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t@Out" + NL + "\tprotected Picker ";
  protected final String TEXT_91 = "Picker = new ";
  protected final String TEXT_92 = "Picker<";
  protected final String TEXT_93 = "Editor, ";
  protected final String TEXT_94 = ">(this, \"";
  protected final String TEXT_95 = "\") {" + NL + "\t\tprotected void add(";
  protected final String TEXT_96 = " instance, ";
  protected final String TEXT_97 = " ref) {" + NL + "\t\t\tinstance.add";
  protected final String TEXT_98 = "(ref);" + NL + "\t\t}" + NL + "\t\tprotected void remove(";
  protected final String TEXT_99 = " instance, ";
  protected final String TEXT_100 = " ref) {" + NL + "\t\t\tinstance.remove";
  protected final String TEXT_101 = "(ref);" + NL + "\t\t}" + NL + "\t\tprotected String getInverseName() {" + NL + "\t\t\treturn \"";
  protected final String TEXT_102 = "\";" + NL + "\t\t}" + NL + "\t};\t";
  protected final String TEXT_103 = NL + NL + "\t/**" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * --- ";
  protected final String TEXT_104 = " ManyToMany Association" + NL + "\t * ------------------------------------------------------------------------" + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\t@Out" + NL + "\tprotected Picker ";
  protected final String TEXT_105 = "Picker = new ";
  protected final String TEXT_106 = "Picker<";
  protected final String TEXT_107 = "Editor, ";
  protected final String TEXT_108 = ">(this, \"";
  protected final String TEXT_109 = "\") {" + NL + "\t\tprotected void add(";
  protected final String TEXT_110 = " instance, ";
  protected final String TEXT_111 = " ref) {" + NL + "\t\t\tinstance.add";
  protected final String TEXT_112 = "(ref);" + NL + "\t\t}" + NL + "\t\tprotected void remove(";
  protected final String TEXT_113 = " instance, ";
  protected final String TEXT_114 = " ref) {" + NL + "\t\t\tinstance.remove";
  protected final String TEXT_115 = "(ref);" + NL + "\t\t}";
  protected final String TEXT_116 = NL + "\t\tpublic boolean isRendered() {" + NL + "\t\t\treturn false;" + NL + "\t\t}";
  protected final String TEXT_117 = NL + "\t};\t";
  protected final String TEXT_118 = NL + NL + "\t//------------------------------------------------------------------------" + NL + "\t//--- ";
  protected final String TEXT_119 = NL + "\t//------------------------------------------------------------------------\t" + NL + "" + NL + "\t/** @generated */" + NL + "\tprotected void initStatusMachine(StatusMachine statusMachine) {";
  protected final String TEXT_120 = NL + NL + "\t\t// ";
  protected final String TEXT_121 = NL + "\t\tstatusMachine.addStatusAction(\"";
  protected final String TEXT_122 = "\", \"";
  protected final String TEXT_123 = "\");";
  protected final String TEXT_124 = NL + "\t}" + NL + "" + NL + "\t/** @generated */" + NL + "\tprotected Object getCurrentStatus() {" + NL + "\t\tif (!isManaged()) {" + NL + "\t\t\treturn \"NOT_MANAGED\";" + NL + "\t\t}";
  protected final String TEXT_125 = NL + "\t\tif (getInstance().is";
  protected final String TEXT_126 = "()) {" + NL + "\t\t\treturn \"";
  protected final String TEXT_127 = "\";" + NL + "\t\t}";
  protected final String TEXT_128 = NL + "\t\treturn null;" + NL + "\t}";
  protected final String TEXT_129 = NL + NL + "\t/** @generated */" + NL + "\t@End" + NL + "\t@Action";
  protected final String TEXT_130 = NL + "\t";
  protected final String TEXT_131 = NL + "\tpublic String ";
  protected final String TEXT_132 = "() {" + NL + "\t\tflush();" + NL + "\t\treturn getFindOutcome();" + NL + "\t}";
  protected final String TEXT_133 = NL + "}";
  protected final String TEXT_134 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
    

    org.eclipse.uml2.uml.Class uml2Class = (org.eclipse.uml2.uml.Class) argument;org.eclipse.uml2.uml.Package uml2Package = uml2Class.getPackage();
    stringBuffer.append(TEXT_1);
    stringBuffer.append(TEXT_2);
    stringBuffer.append(NameHelper.getQualifiedName(uml2Package));
    stringBuffer.append(TEXT_3);
    ImportManager importManager = ImportHelper.makeImportManager("");
    ImportHelper.addImport(uml2Class);
    importManager.addImport("javax.ejb.Stateful");
    importManager.addImport("org.jboss.seam.ScopeType");
    importManager.addImport("org.jboss.seam.annotations.Name");
    importManager.addImport("org.jboss.seam.annotations.Factory");
    importManager.addImport("rad.framework.richfaces.RootTreeNode");
    importManager.addImport("rad.framework.seam.AbstractEditorBean");
    
StringBuffer importStringBuffer = stringBuffer;
int importInsertionPoint = stringBuffer.length();
importManager.addCompilationUnitImports(stringBuffer.toString());

    stringBuffer.append(TEXT_4);
    stringBuffer.append(System.getProperty("user.name"));
    stringBuffer.append(TEXT_5);
    if (!ClassHelper.hasSubclasses(uml2Class)) {
    stringBuffer.append(TEXT_6);
    stringBuffer.append(NameHelper.getUncapName(uml2Class));
    stringBuffer.append(TEXT_7);
    }
    if (!ClassHelper.hasSubclasses(uml2Class) && !ClassHelper.hasSuperClass(uml2Class)) {
    stringBuffer.append(TEXT_8);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_9);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_10);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_11);
    } else if (ClassHelper.hasSubclasses(uml2Class) && !ClassHelper.hasSuperClass(uml2Class)) {
    stringBuffer.append(TEXT_12);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_13);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_14);
    } else if (ClassHelper.hasSubclasses(uml2Class)) {
    stringBuffer.append(TEXT_15);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_16);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_17);
    stringBuffer.append(ClassHelper.getExtends(uml2Class, "EditorBean"));
    stringBuffer.append(TEXT_18);
    } else {
    stringBuffer.append(TEXT_19);
    stringBuffer.append(ClassHelper.getAbstract(uml2Class));
    stringBuffer.append(TEXT_20);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_21);
    stringBuffer.append(ClassHelper.getExtends(uml2Class, "EditorBean"));
    stringBuffer.append(TEXT_22);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_23);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_24);
    }
    stringBuffer.append(TEXT_25);
    if (!ClassHelper.hasSubclasses(uml2Class)) {
    stringBuffer.append(TEXT_26);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_27);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_28);
    stringBuffer.append(NameHelper.getUncapName(uml2Class));
    stringBuffer.append(TEXT_29);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_30);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_31);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_32);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_33);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_34);
    }
    if (!ClassHelper.hasChildren(uml2Class)) {
    stringBuffer.append(TEXT_35);
    }
    if (ClassHelper.hasOneToManyParent(uml2Class) || ClassHelper.hasOneToOneParent(uml2Class)) {
    stringBuffer.append(TEXT_36);
    for (Iterator<Property> i=ClassHelper.getOwnedManyToOneProperties(uml2Class); i.hasNext();) { Property property = i.next();
    if (property.getOpposite() != null) {
    stringBuffer.append(TEXT_37);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_38);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_39);
    stringBuffer.append(NameHelper.capNameNonPlural(property.getOpposite()));
    stringBuffer.append(TEXT_40);
    }}
    for (Iterator<Property> i=ClassHelper.getOwnedOneToOneProperties(uml2Class); i.hasNext();) { Property property = i.next();
    stringBuffer.append(TEXT_41);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_42);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_43);
    stringBuffer.append(NameHelper.capNameNonPlural(property.getOpposite()));
    stringBuffer.append(TEXT_44);
    }
    stringBuffer.append(TEXT_45);
    for (Iterator<Property> i=ClassHelper.getOwnedManyToOneProperties(uml2Class); i.hasNext();) { Property property = i.next();
    if (property.getOpposite() != null) {
    stringBuffer.append(TEXT_46);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_47);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_48);
    stringBuffer.append(NameHelper.capNameNonPlural(property.getOpposite()));
    stringBuffer.append(TEXT_49);
    }}
    stringBuffer.append(TEXT_50);
    for (Iterator<Property> i=ClassHelper.getOwnedOneToOneProperties(uml2Class); i.hasNext();) { Property property = i.next();
    stringBuffer.append(TEXT_51);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_52);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_53);
    stringBuffer.append(NameHelper.capNameNonPlural(property.getOpposite()));
    stringBuffer.append(TEXT_54);
    }
    stringBuffer.append(TEXT_55);
    }
    if (ClassHelper.needsCanDelete(uml2Class)) {
    stringBuffer.append(TEXT_56);
    for (Iterator<Property> i=ClassHelper.getReferencesToMe(uml2Class); i.hasNext();) { Property property = i.next();
    stringBuffer.append(TEXT_57);
    stringBuffer.append(((NamedElement)property.getOwner()).getName());
    stringBuffer.append(TEXT_58);
    stringBuffer.append(property.getName());
    stringBuffer.append(TEXT_59);
    }
    for (Iterator<Property> i=ClassHelper.getOwnedManyToOneProperties(uml2Class); i.hasNext();) { Property property = i.next();
    if (ClassHelper.isMyParent(property) && ClassHelper.isShared(property.getOpposite())) {
    stringBuffer.append(TEXT_60);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_61);
    }}
    stringBuffer.append(TEXT_62);
    }
    stringBuffer.append(TEXT_63);
    for (Iterator<Property> i=ClassHelper.getOwnedCompositeProperties(uml2Class); i.hasNext();) { Property property = i.next();
    for (Iterator<Property> j=ClassHelper.getOwnedManyToOneProperties((org.eclipse.uml2.uml.Class)property.getType()); j.hasNext();) { Property property2 = j.next();
    if ((property2.getOpposite() == null || !property2.getOpposite().isComposite()) && StereotypeHelper.isStereotypeApplied(property2, StereotypeHelper.M2O)) {
    importManager.addImport("rad.framework.seam.ComboBox");
    importManager.addImport("org.jboss.seam.annotations.Out");
    importManager.addImport(NameHelper.getQualifiedName(property2.getType().getPackage()) + ".editor", property2.getType().getName() + "FinderBean." + property2.getType().getName() + "ComboBox");
    stringBuffer.append(TEXT_64);
    stringBuffer.append(NameHelper.getCapName(property2));
    stringBuffer.append(TEXT_65);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(NameHelper.getCapName(property2));
    stringBuffer.append(TEXT_66);
    stringBuffer.append(property2.getType().getName());
    stringBuffer.append(TEXT_67);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_68);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_69);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(NameHelper.getCapName(property2));
    stringBuffer.append(TEXT_70);
    }}
    for (Iterator<Property> j=ClassHelper.getCompositeProperties((org.eclipse.uml2.uml.Class)property.getType()); j.hasNext();) { Property property2 = j.next();
    for (Iterator<Property> k=ClassHelper.getOwnedManyToOneProperties((org.eclipse.uml2.uml.Class)property2.getType()); k.hasNext();) { Property property3 = k.next();
    if (StereotypeHelper.isStereotypeApplied(property3, StereotypeHelper.M2O)) {
    importManager.addImport("rad.framework.seam.ComboBox");
    importManager.addImport("org.jboss.seam.annotations.Out");
    importManager.addImport(NameHelper.getQualifiedName(property3.getType().getPackage()) + ".editor", property3.getType().getName() + "FinderBean." + property3.getType().getName() + "ComboBox");
    stringBuffer.append(TEXT_71);
    stringBuffer.append(NameHelper.getCapName(property3));
    stringBuffer.append(TEXT_72);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(NameHelper.getCapName(property2));
    stringBuffer.append(NameHelper.getCapName(property3));
    stringBuffer.append(TEXT_73);
    stringBuffer.append(property3.getType().getName());
    stringBuffer.append(TEXT_74);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_75);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_76);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(NameHelper.getCapName(property2));
    stringBuffer.append(NameHelper.getCapName(property3));
    stringBuffer.append(TEXT_77);
    }}
    }
    }
    for (Iterator<Property> i=ClassHelper.getOwnedManyToOneProperties(uml2Class); i.hasNext();) { Property property = i.next();
    if (StereotypeHelper.isStereotypeApplied(property, StereotypeHelper.M2O)) {
    importManager.addImport("rad.framework.seam.ComboBox");
    importManager.addImport("org.jboss.seam.annotations.Out");
    importManager.addImport(NameHelper.getQualifiedName(property.getType().getPackage()) + ".editor", property.getType().getName() + "FinderBean." + property.getType().getName() + "ComboBox");
    stringBuffer.append(TEXT_78);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_79);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(TEXT_80);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_81);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_82);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_83);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(TEXT_84);
    if (ClassHelper.isMyParent(property)) {
    stringBuffer.append(TEXT_85);
    }
    stringBuffer.append(TEXT_86);
    }}
    stringBuffer.append(TEXT_87);
    for (Iterator<Property> i=ClassHelper.getOwnedOneToManyProperties(uml2Class); i.hasNext();) { Property property = i.next();
    if (StereotypeHelper.isStereotypeApplied(property, StereotypeHelper.O2M)) {
    if (ClassHelper.isShared(property)) {
    importManager.addImport("rad.framework.richfaces.Picker");
    importManager.addImport("org.jboss.seam.annotations.Out");
    importManager.addImport(NameHelper.getQualifiedName(property.getType().getPackage()) + ".editor", property.getType().getName() + "FinderBean." + property.getType().getName() + "Picker");
    stringBuffer.append(TEXT_88);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_89);
    stringBuffer.append( ClassHelper.isShared(property) ? "Shared " : "");
    stringBuffer.append(TEXT_90);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(TEXT_91);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_92);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_93);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_94);
    stringBuffer.append(property.getName());
    stringBuffer.append(TEXT_95);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_96);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_97);
    stringBuffer.append(NameHelper.capNameNonPlural(property));
    stringBuffer.append(TEXT_98);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_99);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_100);
    stringBuffer.append(NameHelper.capNameNonPlural(property));
    stringBuffer.append(TEXT_101);
    stringBuffer.append(property.getOpposite().getName());
    stringBuffer.append(TEXT_102);
    }
    }}
    for (Iterator<Property> i=ClassHelper.getOwnedManyToManyProperties(uml2Class); i.hasNext();) { Property property = i.next();
    importManager.addImport("rad.framework.richfaces.Picker");
    importManager.addImport("org.jboss.seam.annotations.Out");
    importManager.addImport(NameHelper.getQualifiedName(property.getType().getPackage()) + ".editor", property.getType().getName() + "FinderBean." + property.getType().getName() + "Picker");
    stringBuffer.append(TEXT_103);
    stringBuffer.append(NameHelper.getCapName(property));
    stringBuffer.append(TEXT_104);
    stringBuffer.append(NameHelper.getUncapName(property));
    stringBuffer.append(TEXT_105);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_106);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_107);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_108);
    stringBuffer.append(property.getName());
    stringBuffer.append(TEXT_109);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_110);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_111);
    stringBuffer.append(NameHelper.capNameNonPlural(property));
    stringBuffer.append(TEXT_112);
    stringBuffer.append(NameHelper.getCapName(uml2Class));
    stringBuffer.append(TEXT_113);
    stringBuffer.append(property.getType().getName());
    stringBuffer.append(TEXT_114);
    stringBuffer.append(NameHelper.capNameNonPlural(property));
    stringBuffer.append(TEXT_115);
    if (!ClassHelper.isSource(property)) {
    stringBuffer.append(TEXT_116);
    }
    stringBuffer.append(TEXT_117);
    }
    Region r = ClassHelper.getRegion(uml2Class);
    if (r != null) {
    importManager.addImport("org.jboss.seam.annotations.End");
    importManager.addImport("rad.framework.seam.StatusMachine");
    importManager.addImport("rad.framework.seam.Action");
    stringBuffer.append(TEXT_118);
    stringBuffer.append(NameHelper.getCapName(r));
    stringBuffer.append(TEXT_119);
    for (Iterator<State> k=ClassHelper.getStates(r); k.hasNext();) { State s = k.next();
    if (ClassHelper.getTransitions(s).hasNext()) {
    stringBuffer.append(TEXT_120);
    stringBuffer.append(s.getName());
    for (Iterator<Transition> l=ClassHelper.getTransitions(s); l.hasNext();) { Transition t = l.next();
    stringBuffer.append(TEXT_121);
    stringBuffer.append(s.getName());
    stringBuffer.append(TEXT_122);
    stringBuffer.append(t.getName());
    stringBuffer.append(TEXT_123);
    }}}
    stringBuffer.append(TEXT_124);
    for (Iterator<State> k=ClassHelper.getStates(r); k.hasNext();) { State s = k.next();
    stringBuffer.append(TEXT_125);
    stringBuffer.append(s.getName());
    stringBuffer.append(TEXT_126);
    stringBuffer.append(s.getName());
    stringBuffer.append(TEXT_127);
    }
    stringBuffer.append(TEXT_128);
    for (Iterator<Transition> k=ClassHelper.getTransitions(r); k.hasNext();) { Transition t = k.next();
    stringBuffer.append(TEXT_129);
    if (StereotypeHelper.hasStereotypes(t)) {
    stringBuffer.append(TEXT_130);
    stringBuffer.append(StereotypeHelper.getAnnotations(t));
    }
    stringBuffer.append(TEXT_131);
    stringBuffer.append(t.getName());
    stringBuffer.append(TEXT_132);
    }}
    stringBuffer.append(TEXT_133);
    importStringBuffer.insert(importInsertionPoint, importManager.computeSortedImports());
    stringBuffer.append(TEXT_134);
    return stringBuffer.toString();
  }
}
